﻿using System;
using System.Collections.Generic;
using HAVNet.Core.String;


namespace HAVNet.Intros.AST
{
    public class ASTExprImplicitTypedLambda : ASTExpr
    {
        public object                   exprBody    { get; set; }
        public readonly List<string>    parameters  = new List<string>();

        public override string ToString ()
        {
            System.Diagnostics.Debug.Assert (parameters.Count > 0);

            switch (parameters.Count)
            { 
                case 1:
                    return parameters[1] + " => " + exprBody;
                default:
                    return "(" + Strings.joinobjs(", ", parameters) + ") => " + exprBody;
            }
        }
    }
}
